<?php
$emailid=$_REQUEST['emailid'];

$msgEditScat="";
if(isset($_POST['Submit']))
 {
		mysql_query("UPDATE tb1_cms SET content='".stripslashes($_POST['content'])."' WHERE content_id='".$_POST['type']."'") or die(mysql_error());
	    $msgEditScat="Content Updated Successfully";
	
 }
 
 
?>
<script type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect",
		
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "js/template_list.js",
		external_link_list_url : "js/link_list.js",
		external_image_list_url : "js/image_list.js",
		media_external_list_url : "js/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
</script>
<table width="100%"  border="1" cellspacing="0" class="container">
  <tr>
    <td width="469" height="25" class="tdHeader">Content Management</td>
  </tr>
  <tr>
    <td  height="577">
	<br><br>
          <form action="" method="post" name="formCMS" id="formCMS">
		  
           <table width="100%" border="0" cellspacing="0" align="center">
          <tr>
            <td height="40" colspan="3"><div align="center"><?php if($msgEditScat!="") {echo "<b>".$msgEditScat."</b>"; }?></div></td>
            
          </tr>
		 
		
          <tr>
            <td height="29">&nbsp;</td>
            <td><div align="left">Content Type</div></td>
            <td>
              <div align="left"><select name="type" id="type" onChange="document.formCMS.submit();">
			  <option value="">Select</option>
			  <?php
			  $sqlType="SELECT * FROM tb1_cms WHERE status='Active'";
			  $exeType=mysql_query($sqlType) or die(mysql_error());
			  while($arrType=mysql_fetch_array($exeType)) { 
			  ?>
			  <option value="<?php echo $arrType['content_id']?>" <? if($_POST['type']==$arrType['content_id']){echo "selected";}?>><?php echo $arrType['title']?></option>
			  <?php } ?></select>
              </div></td>
          </tr>
		   <tr>
            <td height="31">&nbsp;</td>
            <td>Content</td>
            <td>
			<?php
			$exeContent=mysql_query("select content from tb1_cms where content_id='".$_POST['type']."'");
			$numContent=mysql_num_rows($exeContent);
			$arrContent=mysql_fetch_array($exeContent);
			?>
			<textarea name="content" cols="55" rows="15" id="content"><?php echo stripslashes($arrContent['content']); ?></textarea></td>
           </tr>		  
		  <tr>
            <td height="65" colspan="3"><div align="center">
                <input name="Submit" type="submit" value="Edit Content" class="button">
              </div></td>
         </tr>
        </table>
       </form>
     </td>
  </tr>
</table>

